import { BaseService } from './base-service';

class UserService extends BaseService {
  /**
   *  获取当前用户信息
   *
   * @author ylq
   * @param  {Object} params
   * @param  {String} params.key
   * @param  {String} params.code
   * @returns
   * @memberof UserService
   */
  getUserInfo(params) {
    return this.request({
      method: 'get',
      url: `/authUser/user`,
      params
    });
  }
  /**
   *  退出登录
   *
   * @author ylq
   * @param  {Object} params
   * @param  {String} params.key
   * @param  {String} params.code
   * @returns
   * @memberof UserService
   */
  logout(params) {
    return this.request({
      method: 'get',
      url: `/auth/logout`,
      params
    });
  }
  /**
   *  临时的一个获取表格的列表 后续要销毁掉
   *
   * @author ylq
   * @param  {Object} params
   * @returns
   * @memberof UserService
   */
  getUserList(params) {
    return this.request({
      method: 'get',
      url: `/client/department/users/${params.departId || 0}`,
      params
    });
  }
  /**
   * 免登陆获取AppId
   *
   * @author ylq
   * @param  {Object} params
   * @returns
   * @memberof UserService
   */
  getAppId(params) {
    return this.request({
      method: 'get',
      url: `/auth/app_id`,
      params
    });
  }
  /**
   * 获取code值后登录
   *
   * @author ylq
   * @param  {Object} params
   * @returns
   * @memberof UserService
   */
  login(params) {
    return this.request({
      method: 'post',
      url: `/auth/login`,
      params: params
    });
  }
}

export const userService = new UserService();
